<!doctype html>
<html lang="zh-CN">
 <head> 
  <meta charset="utf-8"> 
  <link rel="canonical" href="https://blog.csdn.net/TimeZRO/article/details/145343798"> 
  <meta http-equiv="content-type" content="text/html; charset=utf-8"> 
  <meta name="renderer" content="webkit"> 
  <meta name="force-rendering" content="webkit"> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> 
  <meta name="report" content="{&quot;pid&quot;: &quot;blog&quot;, &quot;spm&quot;:&quot;1001.2101&quot;}"> 
  <meta name="referrer" content="always"> 
  <meta http-equiv="Cache-Control" content="no-siteapp">
  <link rel="alternate" media="handheld" href="#">  
  <meta name="applicable-device" content="pc"> 
  <link href="https://g.csdnimg.cn/static/logo/favicon32.ico" rel="shortcut icon" type="image/x-icon"> 
  <title>Cola状态机实战-CSDN博客</title>   
  <meta name="keywords" content="cola状态机"> 
  <meta name="csdn-baidu-search" content="{&quot;autorun&quot;:true,&quot;install&quot;:true,&quot;keyword&quot;:&quot;cola状态机&quot;}"> 
  <meta name="description" content="文章浏览阅读1k次，点赞6次，收藏9次。cola状态机, 状态机模式_cola状态机"> 
  <link rel="stylesheet" type="text/css" href="https://csdnimg.cn/release/blogv2/dist/pc/css/detail_enter-82c6e01b6a.min.css">  
  <link rel="stylesheet" type="text/css" href="https://csdnimg.cn/release/blogv2/dist/pc/themesSkin/skin-sea/skin-sea-d3a08c2048.min.css">    
  <meta name="toolbar" content="{&quot;type&quot;:&quot;0&quot;,&quot;fixModel&quot;:&quot;1&quot;}">   
  <link rel="stylesheet" type="text/css" href="https://csdnimg.cn/public/sandalstrap/1.4/css/sandalstrap.min.css"> 
  <style>
        .MathJax, .MathJax_Message, .MathJax_Preview{
            display: none
        }
    </style>      
 	<style>
	main div.blog-content-box pre {
		max-height: 100%;
		overflow-y: hidden;
	}
	</style>
 </head>  
 <body class="nodata  " style=""> 
  <div id="toolbarBox" style="min-height: 48px;"></div>    
  <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/pc/css/blog_code-01256533b5.min.css"> 
  <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/chart-3456820cac.css"> 
  <link rel="stylesheet" href="https://g.csdnimg.cn/lib/swiper/6.0.4/css/swiper.css">   
  <div class="main_father clearfix d-flex justify-content-center mainfather-concision" style="height:100%;"> 
   <div class="container clearfix container-concision" id="mainBox">  
    <main>  
     <div class="blog-content-box"> 
      <div class="article-header-box" id="article-header-box"> 
       <div class="article-header"> 
        <div class="article-title-box"> 
         <h1 class="title-article" id="articleContentId">Cola状态机实战</h1> 
        </div>  
       </div> 
      </div> 
      <div id="blogHuaweiyunAdvert" class=""></div> 
      <article class="baidu_pl"> 
       <div id="article_content" class="article_content clearfix"> 
        <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/kdoc_html_views-1a98987dfd.css"> 
        <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/ck_htmledit_views-10bf609291.css"> 
        <div id="content_views" class="markdown_views prism-atom-one-dark"> 
         <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> 
          <path stroke-linecap="round" d="M5,0 0,2.5 5,5z" id="raphael-marker-block" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></path> 
         </svg> 
         <h5><a id="_0"></a>一.简介</h5> 
         <p>状态机模式通常用于定义一个对象在有限状态间流转的行为，比如常见的订单中，通常有待支付，已支付，已发货，已完成，已取消，已退款等， 且这些状态的转换都是提前定义好的。这样可以用状态机来定义各个状态间的流转事件和触发事件，比如从待支付到已支付需要触发支付操作，而在触发的事件里可以定义不同的操作，比如支付完成之后发放优惠券等。</p> 
         <h5><a id="_5"></a>二.依赖</h5> 
         <pre><code class="prism language-xml"> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">&gt;</span></span>
     <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">&gt;</span></span>com.alibaba.cola<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">&gt;</span></span>
     <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">&gt;</span></span>cola-component-statemachine<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">&gt;</span></span>
     <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>version</span><span class="token punctuation">&gt;</span></span>最新版本<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>version</span><span class="token punctuation">&gt;</span></span>
 <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">&gt;</span></span>
</code ></pre> 
         <h5><a id="_13"></a>三.实战</h5> 
         <p>此处贴出我在项目中使用的状态机的UML图, 其中部分状态是在此项目中的特殊业务状态:<br> <img src="https://i-blog.csdnimg.cn/img_convert/70221d0beee75843d7cb9508ba0931fd.png" alt=""></p> 
         <h6><a id="1_17"></a>(1)定义状态枚举</h6> 
         <p>状态枚举用于定义状态机会变更到的所有状态</p> 
         <pre><code  style="height: 50vh;" class="prism language-java"><span class="token keyword">public</span> <span class="token keyword">enum</span> <span class="token class-name">OrderState</span> <span class="token punctuation">{
            <!-- --></span>

    <span class="token function">INIT</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">"已创建"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token function">WAITING_FOR_PAY</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token string">"待支付"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token function">WAITING_FOR_ASSIGNED</span><span class="token punctuation">(</span><span class="token number">9</span><span class="token punctuation">,</span><span class="token string">"待分配"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token function">ASSIGNED_PART</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token string">"部分分配"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token function">WAITING_FOR_DELIVER</span><span class="token punctuation">(</span><span class="token number">13</span><span class="token punctuation">,</span> <span class="token string">"待发货"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token function">WAITING_FOR_LOCK</span><span class="token punctuation">(</span><span class="token number">17</span><span class="token punctuation">,</span> <span class="token string">"待锁单"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token function">COMPLETE</span><span class="token punctuation">(</span><span class="token number">21</span><span class="token punctuation">,</span> <span class="token string">"已完成"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token function">CANCEL</span><span class="token punctuation">(</span><span class="token number">25</span><span class="token punctuation">,</span> <span class="token string">"已取消"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token function">WAITING_FOR_REFUND</span><span class="token punctuation">(</span><span class="token number">29</span><span class="token punctuation">,</span> <span class="token string">"待退款"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token function">REFUNDED</span><span class="token punctuation">(</span><span class="token number">33</span><span class="token punctuation">,</span> <span class="token string">"已退款"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token punctuation">;</span>


    <span class="token keyword">private</span> <span class="token class-name">String</span> msg<span class="token punctuation">;</span>
    <span class="token keyword">private</span> <span class="token keyword">int</span> code<span class="token punctuation">;</span>

    <span class="token class-name">OrderState</span><span class="token punctuation">(</span><span class="token keyword">int</span> code<span class="token punctuation">,</span> <span class="token class-name">String</span> msg<span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
        <span class="token keyword">this</span><span class="token punctuation">.</span>code <span class="token operator">=</span> code<span class="token punctuation">;</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span>msg <span class="token operator">=</span> msg<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">public</span> <span class="token keyword">int</span> <span class="token function">getCode</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
        <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span>code<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">getMsg</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
        <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span>msg<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token class-name">OrderState</span> <span class="token function">getInstance</span><span class="token punctuation">(</span><span class="token keyword">int</span> code<span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>

        <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token class-name">OrderState</span> value <span class="token operator">:</span> <span class="token function">values</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>value<span class="token punctuation">.</span>code <span class="token operator">==</span> code<span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
                <span class="token keyword">return</span> value<span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">return</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code ></pre> 
         <h6><a id="2_66"></a>(2)定义事件枚举</h6> 
         <p>事件枚举是状态机会触发的所有事件</p> 
         <pre><code  style="height: 50vh;" class="prism language-java"><span class="token keyword">public</span> <span class="token keyword">enum</span> <span class="token class-name">OrderEvent</span> <span class="token punctuation">{
            <!-- --></span>

	<span class="token function">CREATE_ORDER</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">"创建订单"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
	<span class="token function">PAY</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">"支付"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
	<span class="token function">CANCEL_ORDER</span><span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">"取消订单"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
	<span class="token function">ASSIGNED</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">"分配号码"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
	<span class="token function">PART_ASSIGNED</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token string">"部分分配"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
	<span class="token function">CANCEL_ASSIGNED</span><span class="token punctuation">(</span><span class="token number">6</span><span class="token punctuation">,</span> <span class="token string">"取消分配"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
	<span class="token function">PART_CANCEL_ASSIGNED</span><span class="token punctuation">(</span><span class="token number">7</span><span class="token punctuation">,</span> <span class="token string">"部分取消分配"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
	<span class="token function">DELIVERY</span><span class="token punctuation">(</span><span class="token number">8</span><span class="token punctuation">,</span> <span class="token string">"发货"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
	<span class="token function">LOCK</span><span class="token punctuation">(</span><span class="token number">9</span><span class="token punctuation">,</span> <span class="token string">"锁单"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
	<span class="token function">APPLY_FOR_REFUND</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span> <span class="token string">"申请退款"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
	<span class="token function">REFUND</span><span class="token punctuation">(</span><span class="token number">11</span><span class="token punctuation">,</span> <span class="token string">"退款"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
	<span class="token punctuation">;</span>


	<span class="token keyword">private</span> <span class="token class-name">String</span> msg<span class="token punctuation">;</span>

	<span class="token keyword">private</span> <span class="token keyword">int</span> code<span class="token punctuation">;</span>

	<span class="token class-name">OrderEvent</span><span class="token punctuation">(</span><span class="token keyword">int</span> code<span class="token punctuation">,</span> <span class="token class-name">String</span> msg<span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">this</span><span class="token punctuation">.</span>code <span class="token operator">=</span> code<span class="token punctuation">;</span>
		<span class="token keyword">this</span><span class="token punctuation">.</span>msg <span class="token operator">=</span> msg<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

<span class="token punctuation">}</span>
</code ></pre> 
         <h6><a id="3ID_98"></a>(3)状态机ID</h6> 
         <p>状态机ID是每个状态机的唯一ID, 此处用枚举保存, 也可以用常量</p> 
         <pre><code  style="height: 50vh;" class="prism language-java"><span class="token keyword">public</span> <span class="token keyword">enum</span> <span class="token class-name">OrderStateMachineIdEnum</span> <span class="token punctuation">{
            <!-- --></span>

	<span class="token function">CARD_ORDER</span><span class="token punctuation">(</span><span class="token string">"ORDER_STATE_MACHINE"</span><span class="token punctuation">,</span> <span class="token string">"订单状态机"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

	<span class="token keyword">private</span> <span class="token class-name">String</span> machineId<span class="token punctuation">;</span>

	<span class="token keyword">private</span> <span class="token class-name">String</span> name<span class="token punctuation">;</span>

	<span class="token class-name">OrderStateMachineIdEnum</span><span class="token punctuation">(</span><span class="token class-name">String</span> machineId<span class="token punctuation">,</span> <span class="token class-name">String</span> name<span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">this</span><span class="token punctuation">.</span>machineId <span class="token operator">=</span> machineId<span class="token punctuation">;</span>
		<span class="token keyword">this</span><span class="token punctuation">.</span>name <span class="token operator">=</span> name<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">getMachineId</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span>machineId<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">getName</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span>name<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code ></pre> 
         <pre><code class="prism language-java">
<span class="token class-name">StateMachine</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> orderStateMachine <span class="token operator">=</span> <span class="token class-name">StateMachineFactory</span><span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token class-name">OrderStateMachineIdEnum</span><span class="token punctuation">.</span><span class="token constant">CARD_ORDER</span><span class="token punctuation">.</span><span class="token function">name</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// 此方法用于获取状态机的UML图 生成的是字符串 需要使用工具转换成上面的UML图(直接找个在线工具即可)</span>
<span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>orderStateMachine<span class="token punctuation">.</span><span class="token function">generatePlantUML</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

</code ></pre> 
         <h6><a id="4context_135"></a>(4)context</h6> 
         <p>context 是用于在状态机中传输数据的上下文</p> 
         <pre><code class="prism language-java"><span class="token annotation punctuation">@Data</span>
<span class="token annotation punctuation">@AllArgsConstructor</span>
<span class="token annotation punctuation">@NoArgsConstructor</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">OrderContext</span> <span class="token punctuation">{
            <!-- --></span>

	<span class="token comment">// 订单编号</span>
	<span class="token keyword">private</span> <span class="token class-name">String</span> orderNo<span class="token punctuation">;</span>

	<span class="token comment">// 其他参数 此处使用超类 Object 可以接收任意类型, 使用时根据类型转换</span>
	<span class="token keyword">private</span> <span class="token class-name">Object</span> context<span class="token punctuation">;</span>

<span class="token punctuation">}</span>
</code ></pre> 
         <h6><a id="5conditon_154"></a>(5)conditon</h6> 
         <p>condition是用于定义从一个状态扭转到另一个状态的必须条件, 只有返回值为true会执行后续的action</p> 
         <pre><code  style="height: 50vh;" class="prism language-java"><span class="token annotation punctuation">@Slf4j</span>
<span class="token annotation punctuation">@Component</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">OrderCheckCancelCondition</span> <span class="token keyword">implements</span> <span class="token class-name">Condition</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token punctuation">{
            <!-- --></span>


	<span class="token annotation punctuation">@Override</span>
	<span class="token keyword">public</span> <span class="token keyword">boolean</span> <span class="token function">isSatisfied</span><span class="token punctuation">(</span><span class="token class-name">OrderContext</span> orderContext<span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>

		log<span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token string">"订单:{},取消前校验完成"</span><span class="token punctuation">,</span> orderContext<span class="token punctuation">.</span><span class="token function">getOrderNo</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token keyword">return</span> <span class="token boolean">true</span><span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

<span class="token punctuation">}</span>

</code ></pre> 
         <h6><a id="6action_174"></a>(6)action</h6> 
         <p>action是用于定义从一个状态扭转到另一个状态之后触发的动作</p> 
         <pre><code  style="height: 50vh;" class="prism language-java"><span class="token annotation punctuation">@Slf4j</span>
<span class="token annotation punctuation">@Component</span>
<span class="token annotation punctuation">@AllArgsConstructor</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">OrderCreateAction</span> <span class="token keyword">implements</span> <span class="token class-name">Action</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token punctuation">{
            <!-- --></span>

	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">IOrderService</span> orderService<span class="token punctuation">;</span>


	<span class="token annotation punctuation">@Override</span>
	<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">execute</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span> from<span class="token punctuation">,</span> <span class="token class-name">OrderState</span> <span class="token keyword">to</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span> orderEvent<span class="token punctuation">,</span> <span class="token class-name">OrderContext</span> orderContext<span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		log<span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token string">"创建订单,订单编号:{}"</span><span class="token punctuation">,</span> orderContext<span class="token punctuation">.</span><span class="token function">getOrderNo</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token class-name">CreateOrderDTO</span> createOrderDTO <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token class-name">CreateOrderDTO</span><span class="token punctuation">)</span> orderContext<span class="token punctuation">.</span><span class="token function">getContext</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		orderService<span class="token punctuation">.</span><span class="token function">doCreateOrder</span><span class="token punctuation">(</span><span class="token keyword">to</span><span class="token punctuation">,</span> orderContext<span class="token punctuation">.</span><span class="token function">getOrderNo</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> createOrderDTO<span class="token punctuation">)</span><span class="token punctuation">;</span>

	<span class="token punctuation">}</span>

<span class="token punctuation">}</span>
</code ></pre> 
         <h6><a id="7_198"></a>(7)状态机配置</h6> 
         <p><code>cola</code >状态机可以定义内部状态流转,外部状态流转,批量状态流转</p> 
         <p><code>externalTransition</code >用于定义外部状态流转, <code>from</code >表示当前状态, <code>to</code >表示扭转后的状态,<code>when</code >表示需要满足的条件, <code>perform</code >表示需要执行的动作(action)</p> 
         <p><code>internalTransition</code >用于定于内部状态流转, <code>within</code >表示状态, 内部状态流转不用定义<code>to</code ></p> 
         <p><code>externalTransitions</code >用于定义批量状态流转, 也就是从多个状态可以抵达同一个状态,比如: 订单在已发货,已锁单等状态都可以进行退款操作, <code>fromAmong</code >表示多个<code>from</code >的状态</p> 
         <pre><code  style="height: 50vh;" class="prism language-java"><span class="token annotation punctuation">@Component</span>
<span class="token annotation punctuation">@AllArgsConstructor</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">OrderStateMachine</span> <span class="token punctuation">{
            <!-- --></span>

	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderActionHelper</span> orderActionHelper<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderConditionHelper</span> orderConditionHelper<span class="token punctuation">;</span>


	<span class="token annotation punctuation">@PostConstruct</span>
	<span class="token keyword">public</span> <span class="token class-name">StateMachine</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">createStateMachine</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token comment">// 创建状态机</span>
		<span class="token class-name">StateMachineBuilder</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> builder <span class="token operator">=</span> <span class="token class-name">StateMachineBuilderFactory</span><span class="token punctuation">.</span><span class="token function">create</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token comment">// 外部状态流转 从init到待支付 需要触发创建订单操作</span>
		builder<span class="token punctuation">.</span><span class="token function">externalTransition</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">from</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">INIT</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token keyword">to</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_PAY</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token class-name">OrderEvent</span><span class="token punctuation">.</span><span class="token constant">CREATE_ORDER</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">when</span><span class="token punctuation">(</span>orderConditionHelper<span class="token punctuation">.</span><span class="token function">getOrderCheckCreateCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">perform</span><span class="token punctuation">(</span>orderActionHelper<span class="token punctuation">.</span><span class="token function">getOrderCreateAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token comment">// 外部状态流转 从待支付到已取消 需要触发取消订单操作</span>
		builder<span class="token punctuation">.</span><span class="token function">externalTransition</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">from</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_PAY</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token keyword">to</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">CANCEL</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token class-name">OrderEvent</span><span class="token punctuation">.</span><span class="token constant">CANCEL_ORDER</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">when</span><span class="token punctuation">(</span>orderConditionHelper<span class="token punctuation">.</span><span class="token function">getOrderCheckCancelCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">perform</span><span class="token punctuation">(</span>orderActionHelper<span class="token punctuation">.</span><span class="token function">getOrderCancelAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token comment">// 外部状态流转 从待支付到待分配 需要触发支付操作</span>
		builder<span class="token punctuation">.</span><span class="token function">externalTransition</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">from</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_PAY</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token keyword">to</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_ASSIGNED</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token class-name">OrderEvent</span><span class="token punctuation">.</span><span class="token constant">PAY</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">when</span><span class="token punctuation">(</span>orderConditionHelper<span class="token punctuation">.</span><span class="token function">getOrderCheckPayCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">perform</span><span class="token punctuation">(</span>orderActionHelper<span class="token punctuation">.</span><span class="token function">getOrderPayAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token comment">// 外部状态流转 从待分配到部分分配 需要触发部分分配操作</span>
		builder<span class="token punctuation">.</span><span class="token function">externalTransition</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">from</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_ASSIGNED</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token keyword">to</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">ASSIGNED_PART</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token class-name">OrderEvent</span><span class="token punctuation">.</span><span class="token constant">PART_ASSIGNED</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">when</span><span class="token punctuation">(</span>orderConditionHelper<span class="token punctuation">.</span><span class="token function">getOrderCheckPartAssignCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">perform</span><span class="token punctuation">(</span>orderActionHelper<span class="token punctuation">.</span><span class="token function">getOrderPartAssignAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token comment">// 内部状态流转 部分分配 需要触发部分分配操作</span>
		builder<span class="token punctuation">.</span><span class="token function">internalTransition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">within</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">ASSIGNED_PART</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token class-name">OrderEvent</span><span class="token punctuation">.</span><span class="token constant">PART_ASSIGNED</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">when</span><span class="token punctuation">(</span>orderConditionHelper<span class="token punctuation">.</span><span class="token function">getOrderCheckPartAssignCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">perform</span><span class="token punctuation">(</span>orderActionHelper<span class="token punctuation">.</span><span class="token function">getOrderPartAssignAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token comment">// 外部状态流转 从待分配,部分分配到待发货 需要触发分配操作</span>
		builder<span class="token punctuation">.</span><span class="token function">externalTransitions</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">fromAmong</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">ASSIGNED_PART</span><span class="token punctuation">,</span> <span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_ASSIGNED</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token keyword">to</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_DELIVER</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token class-name">OrderEvent</span><span class="token punctuation">.</span><span class="token constant">ASSIGNED</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">when</span><span class="token punctuation">(</span>orderConditionHelper<span class="token punctuation">.</span><span class="token function">getOrderCheckAssignCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">perform</span><span class="token punctuation">(</span>orderActionHelper<span class="token punctuation">.</span><span class="token function">getOrderAssignAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token comment">// 外部状态流转 从待发货到部分分配 需要触发部分取消分配事件</span>
		builder<span class="token punctuation">.</span><span class="token function">externalTransition</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">from</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_DELIVER</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token keyword">to</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">ASSIGNED_PART</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token class-name">OrderEvent</span><span class="token punctuation">.</span><span class="token constant">PART_CANCEL_ASSIGNED</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">when</span><span class="token punctuation">(</span>orderConditionHelper<span class="token punctuation">.</span><span class="token function">getOrderCheckPartCancelAssignedCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">perform</span><span class="token punctuation">(</span>orderActionHelper<span class="token punctuation">.</span><span class="token function">getOrderPartCancelAssignAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token comment">// 外部状态流转 从待发货,部分分配到待分配 需要触发取消分配事件</span>
		builder<span class="token punctuation">.</span><span class="token function">externalTransitions</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">fromAmong</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_DELIVER</span><span class="token punctuation">,</span> <span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">ASSIGNED_PART</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token keyword">to</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_ASSIGNED</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token class-name">OrderEvent</span><span class="token punctuation">.</span><span class="token constant">CANCEL_ASSIGNED</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">when</span><span class="token punctuation">(</span>orderConditionHelper<span class="token punctuation">.</span><span class="token function">getOrderCheckCancelAssignCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">perform</span><span class="token punctuation">(</span>orderActionHelper<span class="token punctuation">.</span><span class="token function">getOrderCancelAssignAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token comment">// 内部状态流转 部分分配 需要触发部分取消分配操作</span>
		builder<span class="token punctuation">.</span><span class="token function">internalTransition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">within</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">ASSIGNED_PART</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token class-name">OrderEvent</span><span class="token punctuation">.</span><span class="token constant">PART_CANCEL_ASSIGNED</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">when</span><span class="token punctuation">(</span>orderConditionHelper<span class="token punctuation">.</span><span class="token function">getOrderCheckPartCancelAssignedCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">perform</span><span class="token punctuation">(</span>orderActionHelper<span class="token punctuation">.</span><span class="token function">getOrderPartCancelAssignAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token comment">// 外部状态流转 从待发货到待锁单 需要触发发货事件</span>
		builder<span class="token punctuation">.</span><span class="token function">externalTransition</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">from</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_DELIVER</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token keyword">to</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_LOCK</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token class-name">OrderEvent</span><span class="token punctuation">.</span><span class="token constant">DELIVERY</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">when</span><span class="token punctuation">(</span>orderConditionHelper<span class="token punctuation">.</span><span class="token function">getOrderCheckDeliveryCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">perform</span><span class="token punctuation">(</span>orderActionHelper<span class="token punctuation">.</span><span class="token function">getOrderDeliveryAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token comment">// 外部状态流转 从待锁单到已完成 需要触发锁单事件</span>
		builder<span class="token punctuation">.</span><span class="token function">externalTransition</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">from</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_LOCK</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token keyword">to</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">COMPLETE</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token class-name">OrderEvent</span><span class="token punctuation">.</span><span class="token constant">LOCK</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">when</span><span class="token punctuation">(</span>orderConditionHelper<span class="token punctuation">.</span><span class="token function">getOrderCheckLockCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">perform</span><span class="token punctuation">(</span>orderActionHelper<span class="token punctuation">.</span><span class="token function">getOrderLockAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token comment">// 外部状态流转 从待分配,部分分配,待发货,待锁单,已完成到待退款 需要触发申请退款事件</span>
		builder<span class="token punctuation">.</span><span class="token function">externalTransitions</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">fromAmong</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_ASSIGNED</span><span class="token punctuation">,</span> <span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">ASSIGNED_PART</span><span class="token punctuation">,</span> <span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_DELIVER</span><span class="token punctuation">,</span>
				<span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_LOCK</span><span class="token punctuation">,</span> <span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">COMPLETE</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token keyword">to</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_REFUND</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token class-name">OrderEvent</span><span class="token punctuation">.</span><span class="token constant">APPLY_FOR_REFUND</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">when</span><span class="token punctuation">(</span>orderConditionHelper<span class="token punctuation">.</span><span class="token function">getOrderCheckApplyForRefundedCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">perform</span><span class="token punctuation">(</span>orderActionHelper<span class="token punctuation">.</span><span class="token function">getOrderApplyForRefundedAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token comment">// 外部状态流转 从待退款到已退款 需要触发退款事件</span>
		builder<span class="token punctuation">.</span><span class="token function">externalTransition</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">from</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">WAITING_FOR_REFUND</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token keyword">to</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">REFUNDED</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token class-name">OrderEvent</span><span class="token punctuation">.</span><span class="token constant">REFUND</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">when</span><span class="token punctuation">(</span>orderConditionHelper<span class="token punctuation">.</span><span class="token function">getOrderCheckRefundedCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
			<span class="token punctuation">.</span><span class="token function">perform</span><span class="token punctuation">(</span>orderActionHelper<span class="token punctuation">.</span><span class="token function">getOrderRefundedAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token keyword">return</span> builder<span class="token punctuation">.</span><span class="token function">build</span><span class="token punctuation">(</span><span class="token class-name">OrderStateMachineIdEnum</span><span class="token punctuation">.</span><span class="token constant">CARD_ORDER</span><span class="token punctuation">.</span><span class="token function">getMachineId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

<span class="token punctuation">}</span>
</code ></pre> 
         <h6><a id="9_helper_329"></a>(9) helper工具类</h6> 
         <p>定义下面两个工具类的目的在于, 在状态机的配置类中就不需要分别注入依赖, 只需要注入这两个Bean就可以, 不想使用这种方式也可以在状态机配置类中分别注入</p> 
         <pre><code  style="height: 50vh;" class="prism language-java">
<span class="token annotation punctuation">@Component</span>
<span class="token annotation punctuation">@AllArgsConstructor</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">OrderActionHelper</span> <span class="token punctuation">{
            <!-- --></span>


	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderCreateAction</span> orderCreateAction<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderCancelAction</span> orderCancelAction<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderPayAction</span> orderPayAction<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderPartAssignAction</span> orderPartAssignAction<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderAssignAction</span> orderAssignAction<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderPartCancelAssignAction</span> orderPartCancelAssignAction<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderCancelAssignAction</span> orderCancelAssignAction<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderDeliveryAction</span> orderDeliveryAction<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderLockAction</span> orderLockAction<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderApplyForRefundedAction</span> orderApplyForRefundedAction<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderRefundedAction</span> orderRefundedAction<span class="token punctuation">;</span>

	<span class="token keyword">public</span> <span class="token class-name">Action</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderCreateAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderCreateAction<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Action</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderCancelAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderCancelAction<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Action</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderPayAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderPayAction<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Action</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderPartAssignAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderPartAssignAction<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Action</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderAssignAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderAssignAction<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Action</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderPartCancelAssignAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderPartCancelAssignAction<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Action</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderCancelAssignAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderCancelAssignAction<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Action</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderDeliveryAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderDeliveryAction<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Action</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderLockAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderLockAction<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Action</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderApplyForRefundedAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderApplyForRefundedAction<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Action</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderRefundedAction</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderRefundedAction<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>
<span class="token punctuation">}</span>

</code ></pre> 
         <pre><code  style="height: 50vh;" class="prism language-java">
<span class="token annotation punctuation">@Component</span>
<span class="token annotation punctuation">@AllArgsConstructor</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">OrderConditionHelper</span> <span class="token punctuation">{
            <!-- --></span>

	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderCheckCreateCondition</span> orderCheckCreateCondition<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderCheckCancelCondition</span> orderCheckCancelCondition<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderCheckPayCondition</span> orderCheckPayCondition<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderCheckPartAssignCondition</span> orderCheckPartAssignCondition<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderCheckAssignCondition</span> orderCheckAssignCondition<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderCheckPartCancelAssignedCondition</span> orderCheckPartCancelAssignedCondition<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderCheckCancelAssignCondition</span> orderCheckCancelAssignCondition<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderCheckDeliveryCondition</span> orderCheckDeliveryCondition<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderCheckLockCondition</span> orderCheckLockCondition<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderCheckApplyForRefundedCondition</span> orderCheckApplyForRefundedCondition<span class="token punctuation">;</span>
	<span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token class-name">OrderCheckRefundedCondition</span> orderCheckRefundedCondition<span class="token punctuation">;</span>

	<span class="token keyword">public</span> <span class="token class-name">Condition</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderCheckCreateCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderCheckCreateCondition<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Condition</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderCheckCancelCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderCheckCancelCondition<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Condition</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderCheckPayCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderCheckPayCondition<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Condition</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderCheckPartAssignCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderCheckPartAssignCondition<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Condition</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderCheckAssignCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderCheckAssignCondition<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Condition</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderCheckPartCancelAssignedCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderCheckPartCancelAssignedCondition<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Condition</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderCheckCancelAssignCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderCheckCancelAssignCondition<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Condition</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderCheckDeliveryCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderCheckDeliveryCondition<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Condition</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderCheckLockCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderCheckLockCondition<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Condition</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderCheckApplyForRefundedCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderCheckApplyForRefundedCondition<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>

	<span class="token keyword">public</span> <span class="token class-name">Condition</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> <span class="token function">getOrderCheckRefundedCondition</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
		<span class="token keyword">return</span> orderCheckRefundedCondition<span class="token punctuation">;</span>
	<span class="token punctuation">}</span>
<span class="token punctuation">}</span>

</code ></pre> 
         <h6><a id="10_465"></a>(10)示例触发事件</h6> 
         <p>通过<code>fireEvent()</code >方法可以触发事件, 如果需要对操作进行加锁, 可以直接对此方法加锁</p> 
         <pre><code  style="height: 50vh;" class="prism language-java">	<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">cancelOrder</span><span class="token punctuation">(</span><span class="token class-name">String</span> orderNo<span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>

		<span class="token class-name">StateMachine</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">OrderState</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">,</span> <span class="token class-name">OrderContext</span><span class="token punctuation">&gt;</span></span> orderStateMachine <span class="token operator">=</span> <span class="token class-name">StateMachineFactory</span><span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token class-name">OrderStateMachineIdEnum</span><span class="token punctuation">.</span><span class="token constant">CARD_ORDER</span><span class="token punctuation">.</span><span class="token function">getMachineId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token comment">// 此处使用分布式锁处理</span>
		orderUtil<span class="token punctuation">.</span><span class="token function">handlerWithLock</span><span class="token punctuation">(</span>orderNo<span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">-&gt;</span> <span class="token punctuation">{
            <!-- --></span>

			<span class="token class-name">OrderRecordEntity</span> order <span class="token operator">=</span> <span class="token function">getByOrderNo</span><span class="token punctuation">(</span>orderNo<span class="token punctuation">)</span><span class="token punctuation">;</span>
			<span class="token function">checkOrderExists</span><span class="token punctuation">(</span>order<span class="token punctuation">)</span><span class="token punctuation">;</span>

			<span class="token class-name">OrderContext</span> orderContext <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">OrderContext</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
			orderContext<span class="token punctuation">.</span><span class="token function">setOrderNo</span><span class="token punctuation">(</span>orderNo<span class="token punctuation">)</span><span class="token punctuation">;</span>
			orderContext<span class="token punctuation">.</span><span class="token function">setOrder</span><span class="token punctuation">(</span>order<span class="token punctuation">)</span><span class="token punctuation">;</span>

			<span class="token class-name">OrderState</span> orderState <span class="token operator">=</span> orderStateMachine<span class="token punctuation">.</span><span class="token function">fireEvent</span><span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token function">getInstance</span><span class="token punctuation">(</span>order<span class="token punctuation">.</span><span class="token function">getStatus</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token class-name">OrderEvent</span><span class="token punctuation">.</span><span class="token constant">CANCEL_ORDER</span><span class="token punctuation">,</span> orderContext<span class="token punctuation">)</span><span class="token punctuation">;</span>

			<span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token class-name">OrderState</span><span class="token punctuation">.</span><span class="token constant">CANCEL</span><span class="token punctuation">.</span><span class="token function">getCode</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">!=</span> orderState<span class="token punctuation">.</span><span class="token function">getCode</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>
				<span class="token keyword">throw</span> <span class="token keyword">new</span> <span class="token class-name">ServiceException</span><span class="token punctuation">(</span><span class="token string">"此状态无法取消订单!"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
			<span class="token punctuation">}</span>
		<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>


	<span class="token punctuation">}</span>
</code ></pre> 
         <pre><code  style="height: 50vh;" class="prism language-java">	<span class="token comment">/**
	 * 阻塞式获取锁处理订单
	 * @param orderNo
	 * @param runnable
	 */</span>
	<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">handlerWithLock</span><span class="token punctuation">(</span><span class="token class-name">String</span> orderNo<span class="token punctuation">,</span> <span class="token class-name">Runnable</span> runnable<span class="token punctuation">)</span> <span class="token punctuation">{
            <!-- --></span>

		<span class="token class-name">RLock</span> orderLock <span class="token operator">=</span> redissonClient<span class="token punctuation">.</span><span class="token function">getLock</span><span class="token punctuation">(</span>orderNo<span class="token punctuation">)</span><span class="token punctuation">;</span>

		orderLock<span class="token punctuation">.</span><span class="token function">lock</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token keyword">try</span> <span class="token punctuation">{
            <!-- --></span>

			runnable<span class="token punctuation">.</span><span class="token function">run</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token punctuation">}</span> <span class="token keyword">finally</span> <span class="token punctuation">{
            <!-- --></span>

			orderLock<span class="token punctuation">.</span><span class="token function">unlock</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token punctuation">}</span>

	<span class="token punctuation">}</span>
</code ></pre> 
        </div> 
        <link href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/markdown_views-375c595788.css" rel="stylesheet"> 
        <link href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/style-e504d6a974.css" rel="stylesheet"> 
       </div> 
      </article>  
     </div>       
     <div id="pcCommentBox" class="comment-box comment-box-new2 login-comment-box-new" style="display:none"> 
      <div class="has-comment" style="display:block"> 
       <div class="one-line-box"> 
        <div class="has-comment-tit go-side-comment"> 
         <span class="count">0</span>&nbsp;条评论 
        </div> 
        <div class="has-comment-con comment-operate-item"></div> 
        <a class="has-comment-bt-right go-side-comment focus">写评论</a> 
       </div> 
      </div> 
     </div>     
     <div class="blog-footer-bottom" style="margin-top:10px;"></div>   
    </main> 
    <aside class="blog_container_aside "> 
     <div id="asideProfile" class="aside-box active"> 
      <div class="profile-intro d-flex"> 
       <div class="avatar-box d-flex justify-content-center flex-column"> 
        <a href="https://blog.csdn.net/TimeZRO" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;,&quot;spm&quot;:&quot;3001.4121&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/TimeZRO&quot;,&quot;ab&quot;:&quot;new&quot;}"> <img src="https://profile-avatar.csdnimg.cn/default.jpg!1" class="avatar_pic"> </a> 
       </div> 
       <div class="user-info d-flex flex-column profile-intro-name-box"> 
        <div class="profile-intro-name-boxTop"> 
         <a href="https://blog.csdn.net/TimeZRO" target="_blank" class="" id="uid" title="小落的编程笔记" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;,&quot;spm&quot;:&quot;3001.4122&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/TimeZRO&quot;,&quot;ab&quot;:&quot;new&quot;}"> <span class="name" username="TimeZRO">小落的编程笔记</span> </a> 
        </div> 
        <div class="profile-intro-name-boxFooter-new"> 
         <p class="profile-intro-name-leve"> <span> 博客等级 </span> <img class="level" src="https://csdnimg.cn/identity/blog2.png"> </p> 
         <span class="profile-intro-name-years" title="已加入 CSDN 8年">码龄8年</span> 
        </div> 
       </div> 
      </div> 
      <div class="profile-intro-rank-information"> 
       <dl> 
        <a href="https://blog.csdn.net/TimeZRO" data-report-click="{&quot;mod&quot;:&quot;1598321000_001&quot;,&quot;spm&quot;:&quot;3001.4310&quot;}" data-report-query="t=1"> 
         <dd>
          <span>14</span>
         </dd> 
         <dt>
          原创
         </dt> </a> 
       </dl> 
       <dl title="114"> 
        <dd>
         114
        </dd> 
        <dt>
         点赞
        </dt> 
       </dl> 
       <dl title="106"> 
        <dd>
         106
        </dd> 
        <dt>
         收藏
        </dt> 
       </dl> 
       <dl id="fanBox" title="38"> 
        <dd>
         <span id="fan">38</span>
        </dd> 
        <dt>
         粉丝
        </dt> 
       </dl> 
      </div> 
      <div class="profile-intro-name-boxOpration"> 
       <div class="opt-letter-watch-box"> 
        <a class="personal-watch bt-button" id="btnAttent">已关注</a> 
       </div> 
       <div class="opt-letter-watch-box"> 
        <a rel="noopener" class="bt-button personal-letter" href="https://im.csdn.net/chat/TimeZRO" target="_blank">私信</a> 
       </div> 
      </div> 
     </div> 
     <div class="swiper-slide-box-remuneration"> 
      <a data-report-click="{&quot;spm&quot;:&quot;3001.9728&quot;,&quot;extra&quot;:{&quot;index&quot;:&quot;0&quot;}}" data-report-view="{&quot;spm&quot;:&quot;3001.9728&quot;,&quot;extra&quot;:{&quot;index&quot;:&quot;0&quot;}}" href="https://activity.csdn.net/writing?id=11023" target="_blank"> <img src="https://i-operation.csdnimg.cn/images/df0221ef6e464179a32490be26f73a09.jpeg" alt=""> </a> 
     </div> 
     <div class="c-blog-side-box"> 
      <div class="c-blog-side-box-title"> 
       <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/c-blog-slidelogo-White.png" alt=""> 
       <span class="title">猜你想问</span> 
      </div> 
      <div class="c-blog-side-box-content" id="c-blog-side-box-content"> 
       <a href="" data-href="如何实现状态机的状态流转？" data-report-view="{&quot;spm&quot;:&quot;3001.10888&quot;,&quot;extra&quot;:{&quot;ai_cache_id&quot;:&quot;123&quot;,&quot;location&quot;:&quot;ai_blog_left&quot;,&quot;index&quot;:&quot;0&quot;}}" data-report-click="{&quot;spm&quot;:&quot;3001.10888&quot;,&quot;extra&quot;:{&quot;ai_cache_id&quot;:&quot;123&quot;,&quot;location&quot;:&quot;ai_blog_left&quot;,&quot;index&quot;:&quot;0&quot;}}" data-report-query="spm=3001.10888" target="_blank"> <span class="c-blog-side-box-content-title">如何实现状态机的状态流转？</span> <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/arrow-line-right.png" alt=""> </a> 
       <a href="" data-href=" Context在状态机中有何作用？" data-report-view="{&quot;spm&quot;:&quot;3001.10888&quot;,&quot;extra&quot;:{&quot;ai_cache_id&quot;:&quot;123&quot;,&quot;location&quot;:&quot;ai_blog_left&quot;,&quot;index&quot;:&quot;1&quot;}}" data-report-click="{&quot;spm&quot;:&quot;3001.10888&quot;,&quot;extra&quot;:{&quot;ai_cache_id&quot;:&quot;123&quot;,&quot;location&quot;:&quot;ai_blog_left&quot;,&quot;index&quot;:&quot;1&quot;}}" data-report-query="spm=3001.10888" target="_blank"> <span class="c-blog-side-box-content-title"> Context在状态机中有何作用？</span> <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/arrow-line-right.png" alt=""> </a> 
       <a href="" data-href=" Action如何处理状态变更逻辑？" data-report-view="{&quot;spm&quot;:&quot;3001.10888&quot;,&quot;extra&quot;:{&quot;ai_cache_id&quot;:&quot;123&quot;,&quot;location&quot;:&quot;ai_blog_left&quot;,&quot;index&quot;:&quot;2&quot;}}" data-report-click="{&quot;spm&quot;:&quot;3001.10888&quot;,&quot;extra&quot;:{&quot;ai_cache_id&quot;:&quot;123&quot;,&quot;location&quot;:&quot;ai_blog_left&quot;,&quot;index&quot;:&quot;2&quot;}}" data-report-query="spm=3001.10888" target="_blank"> <span class="c-blog-side-box-content-title"> Action如何处理状态变更逻辑？</span> <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/arrow-line-right.png" alt=""> </a> 
      </div> 
     </div> 
     <div id="asideHotArticle" class="aside-box"> 
      <h3 class="aside-title">热门文章</h3> 
      <div class="aside-content"> 
       <ul class="hotArticle-list"> 
        <li> <a href="https://blog.csdn.net/TimeZRO/article/details/145431024" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_541&quot;,&quot;spm&quot;:&quot;3001.4139&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/TimeZRO/article/details/145431024&quot;,&quot;ab&quot;:&quot;new&quot;}"> Spring boot集成xxl-job以及动态任务配置 <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png" alt=""> <span class="read">2545</span> </a> </li> 
        <li> <a href="https://blog.csdn.net/TimeZRO/article/details/145341110" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_541&quot;,&quot;spm&quot;:&quot;3001.4139&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/TimeZRO/article/details/145341110&quot;,&quot;ab&quot;:&quot;new&quot;}"> RabbitMQ从安装到上手 <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png" alt=""> <span class="read">1632</span> </a> </li> 
        <li> <a href="https://blog.csdn.net/TimeZRO/article/details/145344879" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_541&quot;,&quot;spm&quot;:&quot;3001.4139&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/TimeZRO/article/details/145344879&quot;,&quot;ab&quot;:&quot;new&quot;}"> 搭建FTP服务器（Linux） <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png" alt=""> <span class="read">1070</span> </a> </li> 
        <li> <a href="https://blog.csdn.net/TimeZRO/article/details/149149907" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_541&quot;,&quot;spm&quot;:&quot;3001.4139&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/TimeZRO/article/details/149149907&quot;,&quot;ab&quot;:&quot;new&quot;}"> Spring boot 项目中进行kafka Stream app 开发 <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png" alt=""> <span class="read">1054</span> </a> </li> 
        <li> <a href="https://blog.csdn.net/TimeZRO/article/details/145343798" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_541&quot;,&quot;spm&quot;:&quot;3001.4139&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/TimeZRO/article/details/145343798&quot;,&quot;ab&quot;:&quot;new&quot;}"> Cola状态机实战 <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png" alt=""> <span class="read">1050</span> </a> </li> 
       </ul> 
      </div> 
     </div> 
     <div id="asideCategory" class="aside-box aside-box-column flexible-box-new"> 
      <h3 class="aside-title">分类专栏</h3> 
      <div class="aside-content" id="aside-content"> 
       <ul> 
        <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12999955.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12999955.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
          <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class="title oneline"> kafka </span> </a> <span class="special-column-num">1篇</span> </li> 
        <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12883721.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12883721.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
          <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class="title oneline"> RabbitMQ </span> </a> <span class="special-column-num">1篇</span> </li> 
        <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12886541.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12886541.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
          <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class="title oneline"> Seata </span> </a> <span class="special-column-num">2篇</span> </li> 
        <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12883815.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12883815.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
          <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class="title oneline"> 状态机 </span> </a> <span class="special-column-num">1篇</span> </li> 
        <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12978218.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12978218.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
          <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class="title oneline"> 工具Demo </span> </a> <span class="special-column-num">1篇</span> </li> 
        <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12905480.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12905480.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
          <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class="title oneline"> Power Job </span> </a> <span class="special-column-num">1篇</span> </li> 
        <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12883853.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12883853.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
          <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class="title oneline"> FTP </span> </a> <span class="special-column-num">2篇</span> </li> 
        <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12899646.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12899646.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
          <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class="title oneline"> EasyExcel </span> </a> <span class="special-column-num">1篇</span> </li> 
        <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12886540.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12886540.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
          <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class="title oneline"> xxl-job </span> </a> <span class="special-column-num">2篇</span> </li> 
       </ul> 
      </div> 
      <p class="text-center"> <a class="flexible-btn-new" data-report-click="{&quot;spm&quot;:&quot;3001.10779&quot;,&quot;strategy&quot;:&quot;展开全部&quot;}" data-maxheight="0" data-minheight="208px" data-fbox="#aside-content" data-flag="flag"><span class="text">展开全部</span> <img class="look-more" src="https://csdnimg.cn/release/blogv2/dist/pc/img/arrowup-line-bot-White.png" alt=""></a> <a class="flexible-btn-new-close" data-report-click="{&quot;spm&quot;:&quot;3001.10779&quot;,&quot;strategy&quot;:&quot;收起&quot;}" data-minheight="208px" data-fbox="#aside-content" data-scroll="true" data-flag="flag"><span class="text">收起</span> <img class="look-more" src="https://csdnimg.cn/release/blogv2/dist/pc/img/arrowup-line-top-White.png" alt=""></a> </p> 
     </div> 
     <div class="article-previous" id="article-previous"> 
      <dl data-report-click="{&quot;spm&quot;:&quot;3001.10752&quot;,&quot;extend1&quot;:&quot;上一篇&quot;}" data-report-view="{&quot;spm&quot;:&quot;3001.10752&quot;,&quot;extend1&quot;:&quot;上一篇&quot;}"> 
       <dt>
         上一篇： 
       </dt> 
       <dd> 
        <a href="https://blog.csdn.net/TimeZRO/article/details/145343266" data-report-query="spm=3001.10752"> RabbitMQ报错: Shutdown Signal: channel error </a> 
       </dd> 
      </dl> 
      <dl class="next" data-report-click="{&quot;spm&quot;:&quot;3001.10796&quot;,&quot;extend1&quot;:&quot;下一篇&quot;}" data-report-view="{&quot;spm&quot;:&quot;3001.10796&quot;,&quot;extend1&quot;:&quot;下一篇&quot;}"> 
       <dt>
         下一篇： 
       </dt> 
       <dd> 
        <a href="https://blog.csdn.net/TimeZRO/article/details/145344390" data-report-query="spm=3001.10796"> Seata Client 2.0 无法提示业务异常信息问题 </a> 
       </dd> 
      </dl> 
     </div> 
     <div id="asideHotArticle" class="aside-box"> 
      <h3 class="aside-title">大家在看</h3> 
      <div class="aside-content"> 
       <ul class="hotArticle-list"> 
        <li> <a href="https://blog.csdn.net/LanJingTanWei/article/details/154841753" target="_blank" data-report-click="{&quot;spm&quot;:&quot;3001.10093&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/LanJingTanWei/article/details/154841753&quot;,&quot;strategy&quot;:&quot;202_1052723-3545782_RCMD&quot;,&quot;ab&quot;:&quot;new&quot;}" data-report-view="{&quot;spm&quot;:&quot;3001.10093&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/LanJingTanWei/article/details/154841753&quot;,&quot;strategy&quot;:&quot;202_1052723-3545782_RCMD&quot;,&quot;ab&quot;:&quot;new&quot;}"> 工厂车辆定位技术从原理到应用全解析 <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png" alt=""> <span class="read">927</span> </a> </li> 
        <li> <a href="https://blog.csdn.net/Duoya1105/article/details/154732195" target="_blank" data-report-click="{&quot;spm&quot;:&quot;3001.10093&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/Duoya1105/article/details/154732195&quot;,&quot;strategy&quot;:&quot;202_1052723-3545780_RCMD&quot;,&quot;ab&quot;:&quot;new&quot;}" data-report-view="{&quot;spm&quot;:&quot;3001.10093&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/Duoya1105/article/details/154732195&quot;,&quot;strategy&quot;:&quot;202_1052723-3545780_RCMD&quot;,&quot;ab&quot;:&quot;new&quot;}"> MySQL 8.0 | 关系型数据库软件网盘下载与安装教程 <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png" alt=""> <span class="read">784</span> </a> </li> 
        <li> <a href="https://blog.csdn.net/Si15166622538/article/details/154848337" target="_blank" data-report-click="{&quot;spm&quot;:&quot;3001.10093&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/Si15166622538/article/details/154848337&quot;,&quot;strategy&quot;:&quot;202_1052723-3545784_RCMD&quot;,&quot;ab&quot;:&quot;new&quot;}" data-report-view="{&quot;spm&quot;:&quot;3001.10093&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/Si15166622538/article/details/154848337&quot;,&quot;strategy&quot;:&quot;202_1052723-3545784_RCMD&quot;,&quot;ab&quot;:&quot;new&quot;}"> BLE开发必备： Notify的 “特征的能力声明” 和 “客户端的动态配置”，机制解析 <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png" alt=""> <span class="read">352</span> </a> </li> 
        <li> <a href="https://blog.csdn.net/csdddn/article/details/154557163" target="_blank" data-report-click="{&quot;spm&quot;:&quot;3001.10093&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/csdddn/article/details/154557163&quot;,&quot;strategy&quot;:&quot;202_1052723-3545783_RCMD&quot;,&quot;ab&quot;:&quot;new&quot;}" data-report-view="{&quot;spm&quot;:&quot;3001.10093&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/csdddn/article/details/154557163&quot;,&quot;strategy&quot;:&quot;202_1052723-3545783_RCMD&quot;,&quot;ab&quot;:&quot;new&quot;}"> Eigen - STL 迭代器与算法 <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png" alt=""> <span class="read">292</span> </a> </li> 
        <li> <a href="https://blog.csdn.net/2501_93490614/article/details/154792646" target="_blank" data-report-click="{&quot;spm&quot;:&quot;3001.10093&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/2501_93490614/article/details/154792646&quot;,&quot;strategy&quot;:&quot;202_1052723-3545775_RCMD&quot;,&quot;ab&quot;:&quot;new&quot;}" data-report-view="{&quot;spm&quot;:&quot;3001.10093&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/2501_93490614/article/details/154792646&quot;,&quot;strategy&quot;:&quot;202_1052723-3545775_RCMD&quot;,&quot;ab&quot;:&quot;new&quot;}"> 集成开发环境 | Keil 5 MDK下载与详细安装步骤分享 <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png" alt=""> <span class="read">491</span> </a> </li> 
       </ul> 
      </div> 
     </div> 
     <div id="asideArchive" class="aside-box" style="display:block!important; width:300px;"> 
      <h3 class="aside-title">最新文章</h3> 
      <div class="aside-content"> 
       <ul class="inf_list clearfix"> 
        <li class="clearfix"> <a href="https://blog.csdn.net/TimeZRO/article/details/149149907" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_382&quot;,&quot;spm&quot;:&quot;3001.4136&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/TimeZRO/article/details/149149907&quot;,&quot;ab&quot;:&quot;left&quot;}" data-report-view="{&quot;mod&quot;:&quot;popu_382&quot;,&quot;spm&quot;:&quot;3001.4136&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/TimeZRO/article/details/149149907&quot;,&quot;ab&quot;:&quot;left&quot;}">Spring boot 项目中进行kafka Stream app 开发</a> </li> 
        <li class="clearfix"> <a href="https://blog.csdn.net/TimeZRO/article/details/148305994" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_382&quot;,&quot;spm&quot;:&quot;3001.4136&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/TimeZRO/article/details/148305994&quot;,&quot;ab&quot;:&quot;left&quot;}" data-report-view="{&quot;mod&quot;:&quot;popu_382&quot;,&quot;spm&quot;:&quot;3001.4136&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/TimeZRO/article/details/148305994&quot;,&quot;ab&quot;:&quot;left&quot;}">基于AOP实现的数据脱敏功能</a> </li> 
        <li class="clearfix"> <a href="https://blog.csdn.net/TimeZRO/article/details/148125276" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_382&quot;,&quot;spm&quot;:&quot;3001.4136&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/TimeZRO/article/details/148125276&quot;,&quot;ab&quot;:&quot;left&quot;}" data-report-view="{&quot;mod&quot;:&quot;popu_382&quot;,&quot;spm&quot;:&quot;3001.4136&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/TimeZRO/article/details/148125276&quot;,&quot;ab&quot;:&quot;left&quot;}">通过事务钩子避免在事务内部执行异步操作</a> </li> 
       </ul> 
       <div class="archive-bar"></div> 
       <div class="archive-box"> 
        <div class="archive-list-item">
         <a href="https://blog.csdn.net/TimeZRO?type=blog&amp;year=2025&amp;month=07" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_538&quot;,&quot;spm&quot;:&quot;3001.4138&quot;,&quot;ab&quot;:&quot;new&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/TimeZRO?type=blog&amp;year=2025&amp;month=07&quot;}"><span class="year">2025年</span><span class="num">14篇</span></a>
        </div> 
       </div> 
      </div> 
     </div> 
     <!-- 详情页显示目录 --> 
     <!--文章目录--> 
     <div id="asidedirectory" class="aside-box"> 
      <div class="groupfile groupfile-active" id="directory"> 
       <h3 class="aside-title">目录</h3> 
       <div class="align-items-stretch group_item" id="align-items-stretch"> 
        <div class="pos-box"> 
         <div class="scroll-box"> 
          <div class="toc-box"></div> 
         </div> 
        </div> 
       </div> 
       <p class="flexible-btn-new active" id="flexible-btn-groupfile" data-report-click="{&quot;spm&quot;:&quot;3001.10780&quot;,&quot;strategy&quot;:&quot;展开全部&quot;}" data-minheight="117px" data-maxheight="446px" data-fbox="#align-items-stretch"><span class="text">展开全部</span> <img class="look-more" src="https://csdnimg.cn/release/blogv2/dist/pc/img/arrowup-line-bot-White.png" alt=""></p> 
       <p class="flexible-btn-new-close active" data-report-click="{&quot;spm&quot;:&quot;3001.10780&quot;,&quot;strategy&quot;:&quot;收起&quot;}" data-minheight="117px" data-maxheight="446px" data-fbox="#align-items-stretch"><span class="text">收起</span> <img class="look-more" src="https://csdnimg.cn/release/blogv2/dist/pc/img/arrowup-line-top-White.png" alt=""></p> 
      </div> 
     </div> 
    </aside>    
   </div> 
   <div class="recommend-right align-items-stretch clearfix" id="rightAside" data-type="recommend"> 
    <aside class="recommend-right_aside"> 
     <div class="rightside-fixed-hide"> 
     </div> 
     <div id="recommend-right"> 
      <div class="flex-column aside-box groupfile groupfile-active " id="groupfile"> 
       <div class="groupfile-div"> 
        <h3 class="aside-title">目录</h3> 
        <div class="align-items-stretch group_item" id="align-items-stretch-right"> 
         <div class="pos-box"> 
          <div class="scroll-box"> 
           <div class="toc-box"></div> 
          </div> 
         </div> 
        </div> 
        <p class="flexible-btn-new" id="flexible-btn-groupfile" data-report-click="{&quot;spm&quot;:&quot;3001.10782&quot;,&quot;strategy&quot;:&quot;展开全部&quot;}" data-traigger="true" data-minheight="117px" data-maxheight="446px" data-fbox="#align-items-stretch-right"><span class="text">展开全部</span> <img class="look-more" src="https://csdnimg.cn/release/blogv2/dist/pc/img/arrowup-line-bot-White.png" alt=""></p> 
        <p class="flexible-btn-new-close close" data-report-click="{&quot;spm&quot;:&quot;3001.10782&quot;,&quot;strategy&quot;:&quot;收起&quot;}" data-traigger="true" data-minheight="117px" data-maxheight="446px" data-fbox="#align-items-stretch-right"><span class="text">收起</span> <img class="look-more" src="https://csdnimg.cn/release/blogv2/dist/pc/img/arrowup-line-top-White.png" alt=""></p> 
       </div> 
      </div> 
      <div class="article-previous" id="article"> 
       <dl data-report-click="{&quot;spm&quot;:&quot;3001.10752&quot;,&quot;extend1&quot;:&quot;上一篇&quot;}" data-report-view="{&quot;spm&quot;:&quot;3001.10752&quot;,&quot;extend1&quot;:&quot;上一篇&quot;}"> 
        <dt>
          上一篇： 
        </dt> 
        <dd> 
         <a href="https://blog.csdn.net/TimeZRO/article/details/145343266" data-report-query="spm=3001.10752"> RabbitMQ报错: Shutdown Signal: channel error </a> 
        </dd> 
       </dl> 
       <dl class="next" data-report-click="{&quot;spm&quot;:&quot;3001.10796&quot;,&quot;extend1&quot;:&quot;下一篇&quot;}" data-report-view="{&quot;spm&quot;:&quot;3001.10796&quot;,&quot;extend1&quot;:&quot;下一篇&quot;}"> 
        <dt>
          下一篇： 
        </dt> 
        <dd> 
         <a href="https://blog.csdn.net/TimeZRO/article/details/145344390" data-report-query="spm=3001.10796"> Seata Client 2.0 无法提示业务异常信息问题 </a> 
        </dd> 
       </dl> 
      </div> 
      <div class="aside-box kind_person d-flex flex-column flexible-box-new"> 
       <h3 class="aside-title">分类专栏</h3> 
       <div class="align-items-stretch kindof_item" id="kind_person_column"> 
        <div class="aside-content" id="aside-content-column"> 
         <ul> 
          <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12999955.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12999955.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
            <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class=""> kafka </span> </a> <span class="special-column-num">1篇</span> </li> 
          <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12883721.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12883721.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
            <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class=""> RabbitMQ </span> </a> <span class="special-column-num">1篇</span> </li> 
          <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12886541.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12886541.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
            <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class=""> Seata </span> </a> <span class="special-column-num">2篇</span> </li> 
          <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12883815.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12883815.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
            <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class=""> 状态机 </span> </a> <span class="special-column-num">1篇</span> </li> 
          <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12978218.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12978218.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
            <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class=""> 工具Demo </span> </a> <span class="special-column-num">1篇</span> </li> 
          <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12905480.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12905480.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
            <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class=""> Power Job </span> </a> <span class="special-column-num">1篇</span> </li> 
          <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12883853.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12883853.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
            <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class=""> FTP </span> </a> <span class="special-column-num">2篇</span> </li> 
          <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12899646.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12899646.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
            <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class=""> EasyExcel </span> </a> <span class="special-column-num">1篇</span> </li> 
          <li> <a class="clearfix special-column-name" href="https://blog.csdn.net/timezro/category_12886540.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/timezro/category_12886540.html&quot;,&quot;ab&quot;:&quot;new&quot;}"> 
            <div class="special-column-bar "></div> <img src="https://i-blog.csdnimg.cn/columns/default/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="" onerror="this.src='https://i-blog.csdnimg.cn/columns/default/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64'"> <span class=""> xxl-job </span> </a> <span class="special-column-num">2篇</span> </li> 
         </ul> 
        </div> 
        <p class="text-center"> <a class="flexible-btn-new" data-report-click="{&quot;spm&quot;:&quot;3001.10783&quot;,&quot;strategy&quot;:&quot;展开全部&quot;}" data-traigger="true" data-maxheight="0" data-minheight="208px" data-fbox="#aside-content-column" data-flag="flag"><span class="text">展开全部</span> <img class="look-more" src="https://csdnimg.cn/release/blogv2/dist/pc/img/arrowup-line-bot-White.png" alt=""></a> <a class="flexible-btn-new-close" data-report-click="{&quot;spm&quot;:&quot;3001.10783&quot;,&quot;strategy&quot;:&quot;收起&quot;}" data-traigger="true" data-minheight="208px" data-fbox="#aside-content-column" data-scroll="true" data-flag="flag"><span class="text">收起</span> <img class="look-more" src="https://csdnimg.cn/release/blogv2/dist/pc/img/arrowup-line-top-White.png" alt=""></a> </p> 
       </div> 
      </div> 
     </div> 
    </aside> 
   </div> 
   <div class="recommend-right1  align-items-stretch clearfix" id="rightAsideConcision" data-type="recommend"> 
    <aside class="recommend-right_aside"> 
     <div id="recommend-right-concision"> 
      <div class="flex-column aside-box groupfile" id="groupfileConcision"> 
       <div class="groupfile-div1"> 
        <h3 class="aside-title">目录</h3> 
        <div class="align-items-stretch group_item"> 
         <div class="pos-box"> 
          <div class="scroll-box"> 
           <div class="toc-box"></div> 
          </div> 
         </div> 
        </div> 
       </div> 
      </div> 
     </div> 
    </aside> 
   </div> 
  </div> 
  <div class="mask-dark"></div> 
  <div class="skin-boxshadow"></div> 
  <div class="directory-boxshadow"></div> 
  <div class="comment-side-box-shadow comment-side-tit-close" id="commentSideBoxshadow"> 
   <div class="comment-side-content"> 
    <div class="comment-side-tit"> 
     <span class="comment-side-tit-count">评论</span> 
     <img class="comment-side-tit-close" src="https://csdnimg.cn/release/blogv2/dist/pc/img/closeBt.png">
    </div> 
    <div id="pcCommentSideBox" class="comment-box comment-box-new2 " style="display:block"> 
     <div class="comment-edit-box d-flex"> 
      <div class="user-img"> 
       <a href="https://blog.csdn.net/2501_92738035" target="_blank"> <img src="https://profile-avatar.csdnimg.cn/default.jpg!1"> </a> 
      </div> 
      <form id="commentform"> 
       <textarea class="comment-content" name="comment_content" id="comment_content" placeholder="欢迎高质量的评论，低质的评论会被折叠" maxlength="1000"></textarea> 
       <div class="comment-reward-box" style="background-image: url('https://img-home.csdnimg.cn/images/20230131025301.png');"> 
        <a class="btn-remove-reward"></a> 
        <div class="form-reward-box"> 
         <div class="info">
           成就一亿技术人! 
         </div> 
         <div class="price-info">
           拼手气红包
          <span class="price">6.0元</span> 
         </div> 
        </div> 
       </div> 
       <div class="comment-operate-box"> 
        <div class="comment-operate-l"> 
         <span id="tip_comment" class="tip">还能输入<em>1000</em>个字符</span> 
        </div> 
        <div class="comment-operate-c">
          &nbsp; 
        </div> 
        <div class="comment-operate-r"> 
         <div class="comment-operate-item comment-reward"> 
          <img class="comment-operate-img" data-url="https://csdnimg.cn/release/blogv2/dist/pc/img/" src="https://csdnimg.cn/release/blogv2/dist/pc/img/commentReward.png" alt="红包"> 
          <span class="comment-operate-tip">添加红包</span> 
         </div> 
         <div class="comment-operate-item comment-emoticon"> 
          <img class="comment-operate-img" data-url="https://csdnimg.cn/release/blogv2/dist/pc/img/" src="https://csdnimg.cn/release/blogv2/dist/pc/img/commentEmotionIcon.png" alt="表情包"> 
          <span class="comment-operate-tip">插入表情</span> 
          <div class="comment-emoticon-box comment-operate-isshow"> 
           <div class="comment-emoticon-img-box"></div> 
          </div> 
         </div> 
         <div class="comment-operate-item comment-code"> 
          <img class="comment-operate-img" data-url="https://csdnimg.cn/release/blogv2/dist/pc/img/" src="https://csdnimg.cn/release/blogv2/dist/pc/img/commentCodeIcon.png" alt="表情包"> 
          <span class="comment-operate-tip">代码片</span> 
          <div class="comment-code-box comment-operate-isshow"> 
           <ul id="commentCode"> 
            <li><a data-code="html">HTML/XML</a></li> 
            <li><a data-code="objc">objective-c</a></li> 
            <li><a data-code="ruby">Ruby</a></li> 
            <li><a data-code="php">PHP</a></li> 
            <li><a data-code="csharp">C</a></li> 
            <li><a data-code="cpp">C++</a></li> 
            <li><a data-code="javascript">JavaScript</a></li> 
            <li><a data-code="python">Python</a></li> 
            <li><a data-code="java">Java</a></li> 
            <li><a data-code="css">CSS</a></li> 
            <li><a data-code="sql">SQL</a></li> 
            <li><a data-code="plain">其它</a></li> 
           </ul> 
          </div> 
         </div> 
         <div class="comment-operate-item"> 
          <input type="hidden" id="comment_replyId" name="comment_replyId"> 
          <input type="hidden" id="article_id" name="article_id" value="145343798"> 
          <input type="hidden" id="comment_userId" name="comment_userId" value=""> 
          <input type="hidden" id="commentId" name="commentId" value=""> 
          <a data-report-click="{&quot;mod&quot;:&quot;1582594662_003&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4227&quot;,&quot;ab&quot;:&quot;new&quot;}"> <input type="submit" class="btn-comment btn-comment-input" value="评论"> </a> 
         </div> 
        </div> 
       </div> 
      </form> 
     </div> 
     <div class="comment-list-container"> 
      <div class="comment-list-box comment-operate-item"> 
      </div> 
      <div id="lookFlodComment" class="look-flod-comment"> 
       <span class="count"></span>&nbsp;条评论被折叠&nbsp;
       <a class="look-more-flodcomment">查看</a> 
      </div> 
      <div class="opt-box text-center"> 
       <div class="btn btn-sm btn-link-blue" id="btnMoreComment"></div> 
      </div> 
     </div> 
    </div> 
    <div id="pcFlodCommentSideBox" class="pc-flodcomment-sidebox"> 
     <div class="comment-fold-tit">
      <span id="lookUnFlodComment" class="back"><img src="https://csdnimg.cn/release/blogv2/dist/pc/img/commentArrowLeftWhite.png" alt=""></span>被折叠的&nbsp;
      <span class="count"></span>&nbsp;条评论 
      <a href="https://blogdev.blog.csdn.net/article/details/122245662" class="tip" target="_blank">为什么被折叠?</a> 
      <a href="https://bbs.csdn.net/forums/FreeZone" class="park" target="_blank"> <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/iconPark.png">到【灌水乐园】发言</a> 
     </div> 
     <div class="comment-fold-content"></div> 
     <div id="lookBadComment" class="look-bad-comment side-look-comment"> 
      <a class="look-more-comment">查看更多评论<img src="https://csdnimg.cn/release/blogv2/dist/pc/img/commentArrowDownWhite.png" alt=""></a> 
     </div> 
    </div> 
   </div> 
   <div class="comment-rewarddialog-box"> 
    <div class="form-box"> 
     <div class="title-box">
       添加红包 
      <a class="btn-form-close"></a> 
     </div> 
     <form id="commentRewardForm"> 
      <div class="ipt-box"> 
       <label for="txtName">祝福语</label> 
       <div class="ipt-btn-box"> 
        <input type="text" name="name" id="txtName" autocomplete="off" maxlength="50"> 
        <a class="btn-ipt btn-random"></a> 
       </div> 
       <p class="notice">请填写红包祝福语或标题</p> 
      </div> 
      <div class="ipt-box"> 
       <label for="txtSendAmount">红包数量</label> 
       <div class="ipt-txt-box"> 
        <input type="text" name="sendAmount" maxlength="4" id="txtSendAmount" placeholder="请填写红包数量(最小10个)" autocomplete="off"> 
        <span class="after-txt">个</span> 
       </div> 
       <p class="notice">红包个数最小为10个</p> 
      </div> 
      <div class="ipt-box"> 
       <label for="txtMoney">红包总金额</label> 
       <div class="ipt-txt-box error"> 
        <input type="text" name="money" maxlength="5" id="txtMoney" placeholder="请填写总金额(最低5元)" autocomplete="off"> 
        <span class="after-txt">元</span> 
       </div> 
       <p class="notice">红包金额最低5元</p> 
      </div> 
      <div class="balance-info-box"> 
       <label>余额支付</label> 
       <div class="balance-info">
         当前余额
        <span class="balance">3.43</span>元 
        <a href="https://i.csdn.net/#/wallet/balance/recharge" class="link-charge" target="_blank">前往充值 &gt;</a> 
       </div> 
      </div> 
      <div class="opt-box"> 
       <div class="pay-info">
         需支付：
        <span class="price">10.00</span>元 
       </div> 
       <button type="button" class="ml-auto btn-cancel">取消</button> 
       <button type="button" class="ml8 btn-submit" disabled="true">确定</button> 
      </div> 
     </form> 
    </div> 
   </div> 
   <div class="rr-guide-box"> 
    <div class="rr-first-box"> 
     <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/guideRedReward02.png" alt=""> 
     <button class="btn-guide-known next">下一步</button> 
    </div> 
    <div class="rr-second-box"> 
     <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/guideRedReward03.png" alt=""> 
     <button class="btn-guide-known known">知道了</button> 
    </div> 
   </div> 
  </div> 
  <div class="redEnvolope" id="redEnvolope"> 
   <div class="env-box"> 
    <div class="env-container"> 
     <div class="pre-open" id="preOpen"> 
      <div class="top"> 
       <header> 
        <img class="clearTpaErr" :src="redpacketAuthor.avatar" alt=""> 
        <div class="author">
         成就一亿技术人!
        </div> 
       </header> 
       <div class="bot-icon"></div> 
      </div> 
      <footer> 
       <div class="red-openbtn open-start"></div> 
       <div class="tip">
         领取后你会自动成为博主和红包主的粉丝 
        <a class="rule" target="_blank">规则</a> 
       </div> 
      </footer> 
     </div> 
     <div class="opened" id="opened"> 
      <div class="bot-icon"> 
       <header> 
        <a class="creatorUrl" href="" target="_blank"> <img class="clearTpaErr" src="https://profile-avatar.csdnimg.cn/default.jpg!2" alt=""> </a> 
        <div class="author"> 
         <div class="tt">
          hope_wisdom
         </div> 发出的红包 
        </div> 
       </header> 
      </div> 
      <div class="receive-box"> 
       <header></header> 
       <div class="receive-list"> 
       </div> 
      </div> 
     </div> 
    </div> 
    <div class="close-btn"></div> 
   </div> 
  </div> 
  <div class="pay-code"> 
   <div class="pay-money">
    实付
    <span class="pay-money-span" data-nowprice="" data-oldprice="">元</span>
   </div> 
   <div class="content-blance">
    <a class="blance-bt" href="javascript:;">使用余额支付</a>
   </div> 
   <div class="content-code"> 
    <div id="payCode" data-id=""> 
     <div class="renovate"> 
      <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/pay-time-out.png"> 
      <span>点击重新获取</span> 
     </div> 
    </div> 
    <div class="pay-style">
     <span><img src="https://csdnimg.cn/release/blogv2/dist/pc/img/weixin.png"></span>
     <span><img src="https://csdnimg.cn/release/blogv2/dist/pc/img/zhifubao.png"></span>
     <span><img src="https://csdnimg.cn/release/blogv2/dist/pc/img/jingdong.png"></span>
     <span class="text">扫码支付</span>
    </div> 
   </div> 
   <div class="bt-close"> 
    <svg t="1567152543821" class="icon" viewbox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10924" xmlns:xlink="http://www.w3.org/1999/xlink" width="12" height="12"> 
     <defs> 
      <style type="text/css"></style> 
     </defs> 
     <path d="M512 438.378667L806.506667 143.893333a52.032 52.032 0 1 1 73.6 73.621334L585.621333 512l294.485334 294.485333a52.074667 52.074667 0 0 1-73.6 73.642667L512 585.621333 217.514667 880.128a52.053333 52.053333 0 1 1-73.621334-73.642667L438.378667 512 143.893333 217.514667a52.053333 52.053333 0 1 1 73.621334-73.621334L512 438.378667z" fill="" p-id="10925"></path> 
    </svg> 
   </div> 
   <div class="pay-balance"> 
    <input type="radio" class="pay-code-radio" data-type="details"> 
    <span class="span">钱包余额</span> 
    <span class="balance" style="color:#FC5531;font-size:14px;">0</span> 
    <div class="pay-code-tile"> 
     <img src="https://csdnimg.cn/release/blogv2/dist/pc/img/pay-help.png" alt=""> 
     <div class="pay-code-content"> 
      <div class="span"> 
       <p class="title">抵扣说明：</p> 
       <p> 1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。<br> 2.余额无法直接购买下载，可以购买VIP、付费专栏及课程。</p> 
      </div> 
     </div> 
    </div> 
   </div> 
   <a class="pay-balance-con" href="https://i.csdn.net/#/wallet/balance/recharge" target="_blank"><img src="https://csdnimg.cn/release/blogv2/dist/pc/img/recharge.png" alt=""><span>余额充值</span></a> 
  </div>  
  <div class="keyword-dec-box" id="keywordDecBox"></div>       
  <link rel="stylesheet" href="https://g.csdnimg.cn/lib/cboxEditor/1.1.6/embed-editor.min.css"> 
  <link rel="stylesheet" href="https://csdnimg.cn/release/blog_editor_html/release1.6.12/ckeditor/plugins/codesnippet/lib/highlight/styles/atom-one-dark.css">                  
 </body>
</html>